function matrixOutput=refCreate(bgInd,suffix,folderName,photoNamePre,siz)
%create a 3D matrix that has many photo in it.

matrixOutput=zeros(siz,siz,length(bgInd));

for ind=1:length(bgInd)
    photoInd=bgInd(ind);
    fprintf(['refCreate %i ' suffix '\n'],photoInd);
    
    if photoInd<10
        filename=strcat(folderName,photoNamePre,'00',num2str(photoInd),suffix,'.asc');%ͨ��ͳһ��������ʽ����ѭ�����㡣J:\SOCTc\F2013-02-23\RamanRabi
    elseif (photoInd>=10)&&(photoInd<100)
        filename=strcat(folderName,photoNamePre,'0',num2str(photoInd),suffix,'.asc');
    elseif photoInd>=100;
        filename=strcat(folderName,photoNamePre,num2str(photoInd),suffix,'.asc');
    end 

    imageOri=load(filename);
    imageDigital=double(imageOri);
    matrixOutput(:,:,ind)=imageDigital(1:siz,2:(siz+1));
    matrixOutput(:,:,ind)=rot90(matrixOutput(:,:,ind));
end